package com.seagull.sb.bo.impl;

import java.util.Collections;
import java.util.List;

import com.seagull.sb.bo.HomeWorkBO;
import com.seagull.sb.bo.OrganizationBO;
import com.seagull.sb.dao.HomeWorkDAO;
import com.seagull.sb.dao.OrganizationDAO;
import com.seagull.sb.domain.Division;
import com.seagull.sb.domain.HomeWork;
import com.seagull.sb.domain.Notice;
import com.seagull.sb.domain.Organization;
import com.seagull.sb.domain.Teacher;
import com.seagull.sb.util.SBRequestContext;

public class HomeWorkBOImpl extends BaseBOImpl implements HomeWorkBO{
	private HomeWorkDAO homeWorkDAO;

	@Override
	public List<HomeWork> getHomeWork(SBRequestContext rc) {
		Object result;
		try{
			if(rc.forStudent())
				return homeWorkDAO.getHomeWork(rc);
			else if(rc.forTeacher()){
				return homeWorkDAO.getHomeWorkForTeacher(rc);
				// teacher need specific implementation.
			}
				
		}catch(Exception e){
			e.printStackTrace();
		}
		return Collections.EMPTY_LIST;
	}

	public HomeWorkDAO getHomeWorkDAO() {
		return homeWorkDAO;
	}

	public void setHomeWorkDAO(HomeWorkDAO homeWorkDAO) {
		this.homeWorkDAO = homeWorkDAO;
	}

	@Override
	public HomeWork saveHomeWork(SBRequestContext rc, HomeWork homeWork) {
		try {
			boolean homeWorkSaved = homeWorkDAO.saveHomeWork(rc, homeWork);

//			if(homeWorkSaved && homeWork.getId() > 0){
//				noticeDAO.saveNoticeAudit(rc, notice); 
//			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return null;
	}

}
